<script>
export default {
  name: "list",
  data() {
    return {
      list: []
    }
  },
  onLoad() {
    this.$api.consultList({
      member_id: uni.getStorageSync('memberId')
    }).then(res => {
      this.list = res
    })
  },
  methods: {
    todetail(item) {
      this.$u.route({
        type: 'navigateTo',
        url: '/pages/consult/detail',
        params: {
          id: item.id
        }
      })
    }
  }
}
</script>

<template>
<!-- 意见列表 -->
  <view class="list">
    <view class="list-content">
      <view class="list-content-title">意见列表</view>
      <view class="list-content-item" v-for="(item, index) in list" :key="index" @click="todetail(item)">
        <view class="list-content-item-title">{{ item.content }}</view>
        <view class="list-content-item-time">{{ item.create_time }}</view>
      </view>
      <u-empty v-if="list.length === 0" text="暂无记录" mode="list"></u-empty>
    </view>
  </view>
</template>

<style scoped lang="scss">
.list {
  height: 100%;
  background-color: #F5F7FA;
  padding: 20rpx;
  .list-content {
    padding: 20rpx;
    .list-content-title {
      font-size: 32rpx;
      font-weight: bold;
      margin-bottom: 20rpx;
    }
    .list-content-item {
      padding: 20rpx;
      border-bottom: 1px solid #f0f0f0;
      .list-content-item-title {
        font-size: 28rpx;
        margin-bottom: 10rpx;
      }
      .list-content-item-time {
        font-size: 24rpx;
        color: #999;
      }
    }
  }
}

</style>